package com.yfbao.horizon.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class People {

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public People(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        People p1 = new People("MonkeyBrother");
        People p2 = new People("MonkeyBrother");
        People p3 = new People("MonkeyBrother");
        People p4 = new People("MonkeyBrother");
        People p5 = new People("MonkeyBrother");
        List<People> list = new ArrayList<>();

        list.add(p1);
        list.add(p2);
        list.add(p3);
        list.add(p4);
        list.add(p5);

        Map<String, People> collect = list.stream().collect(Collectors.toMap(People::getName, p -> p,(k, v) -> k));
        System.out.println(collect.toString());
    }

}

